package cn.shengchao.config.wxmp;

import me.chanjar.weixin.mp.api.WxMpService;
import me.chanjar.weixin.mp.api.impl.WxMpServiceImpl;
import me.chanjar.weixin.mp.config.impl.WxMpDefaultConfigImpl;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

@Component
public class WeChatConfig {

    @Bean
    public WxMpService wxMpService(){
        WxMpService wxMpService=new WxMpServiceImpl();
        final WxMpDefaultConfigImpl config = new WxMpDefaultConfigImpl();
        // 设置微信公众号的appid
        config.setAppId("wx5c83e0f22df617c2");
        // 设置微信公众号的app corpSecret
        config.setSecret("30885c96951bc1f7cd01f2593e231d6c");
        // 设置微信公众号的token
        config.setToken("");
        // 设置消息加解密密钥
        config.setAesKey("");
        wxMpService.setWxMpConfigStorage(config);
        return wxMpService;
    }
}
